refactor: improve testing infrastructure and split code by domain#15
Merged
refactor: improve testing infrastructure and split code by domain#15
Conversation
Testing improvements: - Add singleton test container (internal/testutil) for faster test execution - Split executor_test.go into domain-specific files: - collection_test.go: find, findOne, aggregate, count, distinct, indexes - database_test.go: show commands, getCollectionNames, getCollectionInfos - error_test.go: parse errors, unsupported operations - Use human-readable database names (e.g., testdb_find_docs) Code organization: - Create internal/translator package for parsing logic - Create internal/executor package for execution logic - Simplify main package to thin wrapper delegating to internal packages Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase to improve testing infrastructure and organize code by domain. The changes move translator and executor logic into internal packages while maintaining backward compatibility through thin public wrappers. The test infrastructure is enhanced with a singleton test container pattern for faster test execution.
Changes:
- Added singleton test container (
internal/testutil) to reuse MongoDB containers across tests - Split code into domain-specific internal packages:
internal/translator(parsing),internal/executor(execution), and further split by collection/database/server operations - Refactored main package (
translator.go,executor.go) into thin wrappers that delegate to internal packages
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| translator.go | Deleted - code moved to internal/translator package |
| method_registry.go | Replaced with backward compatibility comment |
| internal/translator/*.go | New translator package with domain-split files (visitor, types, collection, database, errors, etc.) |
| internal/executor/*.go | New executor package split by domain (executor, collection, database, server) |
| internal/testutil/container.go | New singleton test container for improved test performance |
| executor.go | Refactored to thin wrapper delegating to internal/executor |
| errors.go | Added wrapper functions for backward compatibility |
| *_test.go | Updated to use shared test container and unique database names |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rebelice
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
go test -v ./...go test -race ./...golangci-lint run🤖 Generated with Claude Code